<?php
session_start();
include dirname(__FILE__)."/function.php";
include dirname(dirname(dirname(__FILE__)))."/include/host-base.php";
if(isset($_POST['submited'])&&$_POST['submited']==1) {
	$username = $_POST['login_username'];
	$password = $_POST['login_password'];
	$username = addslashes($username);
	$password = addslashes($password);
	$password = md5($password);
	$verify_code = addslashes(trim($_POST['verify-code']));
	if($verify_code!=$_SESSION['verify_code']) {
		echo '<script type="text/javascript">
							alert("验证码错误!");
						location.href="../index.php";
						</script>';
	}
	else {
	$ret = getSUser($username, $password);

	if($ret) {
		if(mysql_num_rows($ret)>0) {
			$row = mysql_fetch_array($ret);
			$_SESSION['s_username']=$username;
			$_SESSION['s_user_id']=$row['id'];
			$_SESSION['s_user_role']=$row['user_role'];
			header("location:".getHost().'/front-show/index.php');
			exit();
		} else {
			alertInfo("账号密码错误",getHost().'/front-show/index.php');
			
		}
	} 
	}
}
?>